package testBitmap 
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Loader;
    import flash.display.PixelSnapping;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.ProgressEvent;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.net.URLRequest;
    import flash.utils.ByteArray;
	
	public class ImageProcess extends Sprite
	{
		
		private var _loader:Loader;
        private var _image:Bitmap;
        private var _bitmap:BitmapData;
        private var _byteArray:ByteArray;
        private var _pMouse:Point;
		private var _imageLoader:ImageLoader;
      
        public function ImageProcess()
        {
            _pMouse = new Point(0, 0);
           
            _imageLoader = new ImageLoader();
			_imageLoader.addEventListener(ImageEvents.IMAGE_LOADED, _onLoaderReady, false, 0, true);
        }

        public function _onLoaderReady(e:Event):void
        {      
            var __col:int = 5;
            var __row:int = 5;
            var __rect:Rectangle;
            var __padding:int = 0;
          
            var __loaderBMD:BitmapData = new BitmapData(_imageLoader.loader.width, _imageLoader.loader.height);
            
			if (_imageLoader.loader.width % __col != 0)
			{
				_imageLoader.loader.width -= _imageLoader.loader.width % __col;
			}
			if (_imageLoader.loader.height % __col != 0)
			{
				_imageLoader.loader.height -= _imageLoader.loader.height % __col;
			}
			
			var _bm:BlockManager = new BlockManager();
			addChild(_bm);
			_bm.createBlockManagerSource(_imageLoader.loader.width, _imageLoader.loader.height, __col, __row);
			
			
        }
		
		
    }
}